package teatime.core.service.interceptor;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Around;

import teatime.core.utils.BusinessLogger;


@Aspect
public class ServiceInterceptor {
	
	@Around("execution(* com.sbs.*.service.impl.*.*(..))")
	public Object afterMethod(ProceedingJoinPoint pjp) throws Throwable {
		
		BusinessLogger.getLogger().info(
				"[Service Begin]"
						+ pjp.getSignature().getDeclaringTypeName()
						+ "@" + pjp.getSignature().getName());

		Object o = null;
		try {
			o = pjp.proceed();
			BusinessLogger.getLogger().info("[Service End In Success]");
			return o;
		} catch (Exception e) {
			BusinessLogger.getLogger().info("[Service End In Exception]");
			throw e;
		}
	}
}
